<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>支付订单管理</title>
    <jsp:include page="/resources/inc/head.jsp" flush="true"/>
</head>
<body>
<div id="main">
    <div id="collapseOne" class="panel-collapse collapse">
        <div class="panel panel-default" id="queryHead">
            <div class="panel-body">
                <form id="queryForm" method="post" class="form-horizontal">
                    <label class="col-sm-2 search-control control-label" >平台订单号：</label>
                    <div class="col-sm-2 search-control">
                        <input type="text" class="form-control" name="orderid" id="orderid"/>
                    </div>
                    <label class="col-sm-2 search-control control-label" >商户ID：</label>
                    <div class="col-sm-2 search-control">
                        <input type="text" class="form-control" name="mchId" id="mchId"/>
                    </div>
                    <label class="col-sm-2 search-control control-label" >商户订单号：</label>
                    <div class="col-sm-2 search-control">
                        <input type="text" class="form-control" name="mchOrderNo" id="mchOrderNo"/>
                    </div>
                    <label class="col-sm-2 search-control control-label" >开始时间：</label>
                    <div class="col-sm-2 search-control">
                        <input type="text" id="begintime" name="begintime"  class="form-control" data-date-format="yyyy-mm-dd hh:mi:ss" placeholder="开始时间" value="" pattern="yyyy-MM-dd" />
                    </div>
                    <label class="col-sm-2 search-control control-label" >结束时间：</label>
                    <div class="col-sm-2 search-control">
                        <input type="text" id="endtime" class="form-control" name="endtime"  data-date-format="yyyy-mm-dd  hh:mi:ss" placeholder="结束时间" value="" pattern="yyyy-MM-dd" />
                    </div>
                    <div class="col-sm-2 search-control ">
                        <button type="button" class="btn btn-primary" id="search_btn">查询</button>
                        <button type="reset" class="btn btn-primary" id="reset_btn">重置</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div id="toolbar">
        <a class="waves-effect waves-button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne"><i class="zmdi zmdi-search"></i> 高级搜索</a>
    </div>
    <table id="table"></table>
</div>
<jsp:include page="/resources/inc/footer.jsp" flush="true"/>
<jsp:include page="/resources/inc/export.jsp" flush="true"/>

<script>
    var $table = $('#table');
    $(function() {
        // bootstrap table初始化
        $table.bootstrapTable({
            url: '${basePath}/manage/payorder/list',
            height: getNoHeadHeight($('#queryHead').height),
            detailFormatter: 'detailFormatter',
            paginationLoop: false,
            silentSort: false,
            smartDisplay: false,
            escape: true,
            searchOnEnterKey: true,
            maintainSelected: true,
            toolbar: '#toolbar',               //工具按钮用哪个容器
            striped: true,                      //是否显示行间隔色
            cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
            pagination: true,                   //是否显示分页（*）
            sortable: true,                     //是否启用排序
            sortOrder: "asc",                   //排序方式
            sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
            pageNumber: 1,                      //初始化加载第一页，默认第一页,并记录
            pageSize: 10,                     //每页的记录行数（*）
            pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
            search: false,                      //是否显示表格搜索
            strictSearch: true,
            showColumns: true,                  //是否显示所有的列（选择显示的列）
            showRefresh: true,                  //是否显示刷新按钮
            minimumCountColumns: 2,             //最少允许的列数
            clickToSelect: true,                //是否启用点击选中行
            showToggle: true,                   //是否显示详细视图和列表视图的切换按钮
            cardView: false,                    //是否显示详细视图
            detailView: false,                  //是否显示父子表
            idField: 'id',
            toolbar: '#toolbar',
            queryParams : function(params) {
                return splitFormSerializeValue('queryForm',params);
            },
            columns: [
                {field: 'ck', checkbox: true},
                {field: 'payorderid', title: '支付订单号'},
                {field: 'mchid', title: '商户ID'},
                {field: 'mchorderno', title: '商户订单号'},
                {field: 'ordertype', title: '订单类型',formatter: function (value, row, index) {
                        return getDictText("PAY_ORDER_TYPE",value);
                    }},
                {field: 'status', title: '通知状态',formatter: function (value, row, index) {
                        return getDictText("PAY_ORDER_NOTIFY_STATUS",value);
                    }},
                {field: 'result', title: '通知响应结果'},
                {field: 'notifycount', title: '通知次数'},
                {field: 'lastnotifytime', title: '最后一次通知时间',formatter:'detailLongDateTimeFormatter'},
                {field: 'createtime', title: '创建时间',formatter:'detailLongDateTimeFormatter'}
            ]
            <shiro:hasPermission name="pay:payorder:export">
            ,
            //导出excel表格设置
            showExport: phoneOrPc(),              //是否显示导出按钮(此方法是自己写的目的是判断终端是电脑还是手机,电脑则返回true,手机返回falsee,手机不显示按钮)
            exportDataType: "basic",              //basic', 'all', 'selected'.
            exportTypes:['excel','xlsx'],	    //导出类型
            exportOptions:{
                //ignoreColumn: [0,0],            //忽略某一列的索引
                fileName: '订单数据导出',              //文件名称设置
                excelstyles: ['background-color', 'color', 'font-size', 'font-weight'],
                //onMsoNumberFormat: DoOnMsoNumberFormat
            }
            //导出excel表格设置
            </shiro:hasPermission>
        });
        //初始化搜索表单状态
        getSelectOption('UM_CONSUMPTION_ORDER_STATUS','status');

        //查询按钮事件
        $('#search_btn').click(function() {
            $('#table').bootstrapTable('refresh', {
                //得到查询的参数
                queryParams : function(params) {
                    return splitFormSerializeValue('queryForm',params);
                },
                url : '${basePath}/manage/payorder/list'
            });
        })
        //重置按钮事件
        $("#reset_btn").click(function(){
            $("#queryForm").resetForm();
        });

        $('#begintime,#endtime').datepicker();
    });
</script>
</body>
</html>